<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=0, user-scalable=no"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<meta name="format-detection" content="telephone=no">
	<title>邮箱验证</title>
	<link rel="stylesheet" type="text/css" href="../../Public/css/reset.css"/>
	<link rel="stylesheet" type="text/css" href="../../Public/css/main.css"/>
	<link rel="stylesheet" type="text/css" href="../../Public/css/list.css"/>
	<script type="text/javascript" src="../../Public/js/jquery-2.1.4.min.js"></script>
	<script type="text/javascript" src="../../Public/js/rem.js"></script>
</head>
<body class="b5">
	<!-- head start -->
	<header class="header psa clear bg-color1 bg-color3">
		<span class="back-button" onclick="history.go(-1)">
			<i></i>
			邮箱验证
		</span>
	</header>
	<!-- head end -->

	<!-- content start -->
	<section class="reg_box mt9">
		<form action="{:U('user/center/editEmail')}" method="post">
			<label class="clear get_yzm">
				<input class="fl yzm loginusername" type="text" name="newemail" id="newemail" placeholder="新的邮箱号" class="clear"/>
				<span class="fl get_num"><b><input type="button" value="发送激活邮件" style="margin-top:0.1rem;color: #00A2CA;" class="fl editbtn"/></span>
				<input class="fl yzm loginuserpasswordt" type="text" name="verify" id="verify" placeholder="请输入验证码" class="clear"/>
				<strong class="fl"><b>*验证码邮件将发送至</b></strong>
			</label>
			<input class="reg_submit rads" type="button" name="" value="修改" id="login_btn"/>
		</form>
	</section>
	<!-- content end -->
<script>
 $(function(){
       //var index = parent.layer.getFrameIndex(window.name); 
      $('.editbtn').on("click",function(){
	        $.ajax({
				   url:"{:U('user/center/updateEmail')}",
				   type: "POST",
				   data: {},
				   async:false,
				   success: function(data){
					   if(data.status=='1'){
						 //window.location.reload();
						 alert(data.info);
					  }else{
						 alert(data.info);
					  }
				   }
			});
	  });
      $('#login_btn').on("click",function(){
	      var newemail=$('#newemail').val();
		  var verify=$('#verify').val();
	       $.ajax({
				   url:"{:U('user/center/editEmail')}",
				   type: "POST",
				   data: {newemail:newemail,verify:verify},
				   async:false,
				   success: function(data){
					   if(data.status=='1'){
						 layer.msg('邮箱修改成功！');
						  parent.layer.close(index);
					  }else{
						 $(".login_warning").show();
						 $(".login_warning").html(data.info);
					  }
				   }
			});
      });
 });
</script>
</body>
</html>